图片加载错误提示

chengzhenyu 7 年之前
父節點
當前提交
c7e635bd42

+ 1 - 14
.idea/misc.xml

@@ -1,8 +1,5 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <project version="4">
3
-  <component name="EntryPointsManager">
4
-    <entry_points version="2.0" />
5
-  </component>
6 3
   <component name="NullableNotNullManager">
7 4
     <option name="myDefaultNullable" value="android.support.annotation.Nullable" />
8 5
     <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
@@ -27,17 +24,7 @@
27 24
       </value>
28 25
     </option>
29 26
   </component>
30
-  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
31
-    <OptionsSetting value="true" id="Add" />
32
-    <OptionsSetting value="true" id="Remove" />
33
-    <OptionsSetting value="true" id="Checkout" />
34
-    <OptionsSetting value="true" id="Update" />
35
-    <OptionsSetting value="true" id="Status" />
36
-    <OptionsSetting value="true" id="Edit" />
37
-    <ConfirmationsSetting value="0" id="Add" />
38
-    <ConfirmationsSetting value="0" id="Remove" />
39
-  </component>
40
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
27
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
41 28
     <output url="file://$PROJECT_DIR$/build/classes" />
42 29
   </component>
43 30
   <component name="ProjectType">

+ 9 - 9
app/build.gradle

@@ -95,13 +95,13 @@ buildscript {
95 95
             url uri('..\\repo')
96 96
         }
97 97
     }
98
-    dependencies {
99
-        //group:module:version
100
-        classpath 'com.android.plugin.hotpatch:hotpatch:1.0.0'
101
-    }
98
+//    dependencies {
99
+//        //group:module:version
100
+//        classpath 'com.android.plugin.hotpatch:hotpatch:1.0.0'
101
+//    }
102 102
 }
103
-apply plugin: 'plugin.hotpatch'
104
-
105
-hotpatch{
106
-    includePackageDir='ai\\pai\\lensman'
107
-}
103
+//apply plugin: 'plugin.hotpatch'
104
+//
105
+//hotpatch{
106
+//    includePackageDir='ai\\pai\\lensman'
107
+//}

+ 24 - 1
app/src/main/java/ai/pai/lensman/session/PhotoRecyclerAdapter.java

@@ -2,6 +2,7 @@ package ai.pai.lensman.session;
2 2
 
3 3
 import android.content.Context;
4 4
 import android.content.Intent;
5
+import android.graphics.Bitmap;
5 6
 import android.support.v7.widget.RecyclerView;
6 7
 import android.view.LayoutInflater;
7 8
 import android.view.View;
@@ -12,6 +13,8 @@ import android.widget.Toast;
12 13
 
13 14
 import com.android.common.utils.DeviceUtils;
14 15
 import com.nostra13.universalimageloader.core.DisplayImageOptions;
16
+import com.nostra13.universalimageloader.core.assist.FailReason;
17
+import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
15 18
 
16 19
 import java.util.ArrayList;
17 20
 
@@ -92,7 +95,27 @@ public class PhotoRecyclerAdapter extends RecyclerView.Adapter<PhotoRecyclerAdap
92 95
             return;
93 96
         }
94 97
         final PhotoBean item = photoList.get(position);
95
-        ImageLoaderUtils.displayLocalImage(item.photoPath, holder.photo, options);
98
+        ImageLoaderUtils.displayLocalImage(item.photoPath, holder.photo, options, new ImageLoadingListener() {
99
+            @Override
100
+            public void onLoadingStarted(String s, View view) {
101
+
102
+            }
103
+
104
+            @Override
105
+            public void onLoadingFailed(String s, View view, FailReason failReason) {
106
+                Toast.makeText(context,"请检查相机设置的照片输出格式",Toast.LENGTH_SHORT).show();
107
+            }
108
+
109
+            @Override
110
+            public void onLoadingComplete(String s, View view, Bitmap bitmap) {
111
+
112
+            }
113
+
114
+            @Override
115
+            public void onLoadingCancelled(String s, View view) {
116
+
117
+            }
118
+        });
96 119
         int height = width * 10 / 16;
97 120
         ViewGroup.LayoutParams lp = holder.photo.getLayoutParams();
98 121
         lp.width = width;

+ 5 - 0
app/src/main/java/ai/pai/lensman/utils/ImageLoaderUtils.java

@@ -7,6 +7,7 @@ import com.nostra13.universalimageloader.core.DisplayImageOptions;
7 7
 import com.nostra13.universalimageloader.core.ImageLoader;
8 8
 import com.nostra13.universalimageloader.core.assist.ImageScaleType;
9 9
 import com.nostra13.universalimageloader.core.imageaware.ImageViewAware;
10
+import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
10 11
 
11 12
 public class ImageLoaderUtils {
12 13
 
@@ -20,6 +21,10 @@ public class ImageLoaderUtils {
20 21
         ImageLoader.getInstance().displayImage("file://" + uri, new ImageViewAware(imageView), options, null, null);
21 22
     }
22 23
 
24
+    public static void displayLocalImage(String uri, ImageView imageView, DisplayImageOptions options,ImageLoadingListener listener) {
25
+        ImageLoader.getInstance().displayImage("file://" + uri, new ImageViewAware(imageView), options, listener, null);
26
+    }
27
+
23 28
     /**
24 29
      * display Drawable image
25 30
      * @param uri

+ 1 - 1
build.gradle

@@ -5,7 +5,7 @@ buildscript {
5 5
         jcenter()
6 6
     }
7 7
     dependencies {
8
-        classpath 'com.android.tools.build:gradle:2.3.2'
8
+        classpath 'com.android.tools.build:gradle:2.3.3'
9 9
         classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
10 10
         // NOTE: Do not place your application dependencies here; they belong
11 11
         // in the individual module build.gradle files